package main

import (
	"fmt"
	"sync"
)

type Student struct {
	Name string
	Age  int32
}

var studentPool = sync.Pool{
	New: func() interface{} {
		return &Student{}
	},
}

func main() {
	stu := studentPool.Get().(*Student)
	stu.Name = "aa"

	fmt.Println(stu.Name)

	studentPool.Put(stu)

	stu2 := studentPool.Get().(*Student)
	fmt.Println(stu2.Name)

	if stu2.Name == "aa" {
		return
	} else if stu2.Name == "bb" {

	} else {

	}
	defer fmt.Println("1111111111")
}
